<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<!-- <a href="catalog/form" style="float: right;" id="add_a" data-id="-1" style="float: right;">目录新增</a> -->

<a href="javascript:;"  style="float: right;" id="add_a" data-id="-1"  style="float: right;">目录新增</a>

<link rel="stylesheet" href="assert/jquery/treetable/css/jquery.treetable.css">
<link rel="stylesheet" href="assert/jquery/treetable/css/jquery.treetable.theme.default.css">

<table id="table_catalog" border="1" style="width: 100%">
	<tr>
		<th>目录名称</th>
		<th>目录信息</th>
		<th>操作</th>
	</tr>
	<tbody	id="tbody_table"   data-listurl="catalog/list" >
		
	</tbody>
</table>
<script type="text/javascript" src="assert/jquery/jquery-3.4.1.js"></script>
<script type="text/javascript" src="assert/jquery/treetable/jquery.treetable.js"></script>
<script type="text/javascript" src="assert/pagejs/catalog_index.js"></script>


 <script >
	 $(document).ready(function(){
		
		
		window.initData = function (){
		
			$.ajax({
				url:'catalog/list',
				success:function(tableHTML){
					$("#tbody_table").html(tableHTML);
					$('#table_catalog').treetable({ expandable:true });
					
				}
			});
		}
		// 初始化 table
		initData()
		
		 $('#tbody_table').off('click','#addchild_a').on('click','#addchild_a',function(){
			$.ajax({
				url:$(this).attr('href'),
				success:function(formHTML){
					layer.open({
						type:1,
						title:'新增子目录',
						area:"500px",
						content:formHTML
					});
				}
			});
			return false;
		});  


		/* $("#index_table").treetable({
			expandable:true
		}); */
	}); 
</script>















